package com.hertz.appr.pojo.db;

import java.util.Date;

import com.hertz.appr.util.Util;

/**
 * PromoteResult entity. @author MyEclipse Persistence Tools
 */

public class PromoteResult implements java.io.Serializable,Comparable<PromoteResult> {

	// Fields

	private Long id;
	private String uid;
	private String nick;
	private String provider;
	private Long actionId;
	private String follow;
	private String comment;
	private String repost;
	private Integer toUserNum = 0;
	private Long firstTime = Long.MAX_VALUE;
	private Short award;
	private Long systemTime;

	// Constructors

	/** default constructor */
	public PromoteResult() {
	}

	/** minimal constructor */
	public PromoteResult(Long id, String follow, String comment, String repost,
			Integer toUserNum) {
		this.id = id;
		this.follow = follow;
		this.comment = comment;
		this.repost = repost;
		this.toUserNum = toUserNum;
	}

	
	// Property accessors

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getFollow() {
		return follow;
	}

	public void setFollow(String follow) {
		this.follow = follow;
	}

	public String getComment() {
		return this.comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public String getRepost() {
		return this.repost;
	}

	public void setRepost(String repost) {
		this.repost = repost;
	}

	public Integer getToUserNum() {
		return this.toUserNum;
	}

	public void setToUserNum(Integer toUserNum) {
		this.toUserNum = toUserNum;
	}

	public Long getFirstTime() {
		return firstTime;
	}
	
	public String getFirstTimeStr(){
		String str = "";
		try {
			str = Util.parseDate(new Date(firstTime), "yyyy-MM-dd HH:mm:ss");
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return str;
	}

	public void setFirstTime(Long firstTime) {
		this.firstTime = firstTime;
	}

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public String getProvider() {
		return provider;
	}

	public void setProvider(String provider) {
		this.provider = provider;
	}

	public Long getActionId() {
		return actionId;
	}
	public void setActionId(Long actionId) {
		this.actionId = actionId;
	}
	public String getNick() {
		return nick;
	}
	public void setNick(String nick) {
		this.nick = nick;
	}

	public Short getAward() {
		return award;
	}

	public void setAward(Short award) {
		this.award = award;
	}

	@Override
	public int compareTo(PromoteResult o) {
		// TODO Auto-generated method stub
		if(this == o)
			return 0;
		int countCompare = this.toUserNum.compareTo(o.getToUserNum());
		if(countCompare != 0){
			return 0 - countCompare;
		}else{
			return Long.valueOf(this.firstTime).compareTo(o.getFirstTime());
		}
	}

	public Long getSystemTime() {
		return systemTime;
	}

	public void setSystemTime(Long systemTime) {
		this.systemTime = systemTime;
	}
	
}